package com.kmxd.ams.app.event.archive;

import com.kmxd.ams.app.event.archive.command.ArchTypeCountCmd;
import com.kmxd.ams.client.event.archive.ArchTypeCountEvent;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * 档案门类
 *
 * @author ZuoLG
 */
@Slf4j
@Component
@AllArgsConstructor
public class ArchTypeListener {
  private final ArchTypeCountCmd archTypeCountCmd;

  /**
   * 实现复制功能
   *
   * @param event
   */
  @Async
  @SneakyThrows
  @TransactionalEventListener(fallbackExecution = true)
  public void count(ArchTypeCountEvent event) {
    archTypeCountCmd.count();
  }
}
